package operation;

import book.Book;

import book.BookList;

import java.util.Scanner;

public class AddOperation implements Operation {

    @Override
    public void work(BookList bookList) {
        System.out.println("增添一本书!");
        Scanner scanner = new Scanner(System.in);

        System.out.println("请输入书名：");
        String name = scanner.nextLine();

        System.out.println("请输入作者：");
        String author = scanner.nextLine();

        System.out.println("请输入类别：");
        String category = scanner.nextLine();

        System.out.println("请输入价格：");
        int price = scanner.nextInt();

        Book newBook = new Book(name, author, category, price);

        bookList.addBook(newBook);

        System.out.println("添加成功!");
    }
}
